<script>
var trasheditem;
var blocktrashed;
var numtrashed;
$(document).ready(function(){
    $(".block").draggable({helper:'clone'}); 
    $(".drop").droppable({
	drop: function(event,ui) {
	$(this).html($(ui.draggable).clone());
	trasheditem =$(ui.draggable).attr('id');
	var obj = jQuery.parseJSON(trasheditem);
	blocktrashed = obj.type;
	numtrashed = obj.num;
	console.log(trasheditem);
	}
	});
	});
</script>
<div class="titlepanel"><?php if (!empty($playername)) echo __("Inventory for ",true).$playername; ?></div>
<div class="ui-widget-content contentpanel" style="height: 179px;">
<div id="show_inv" class="inventorypanel">
<?php
$inv1 = "";
$inv2 = "";
foreach ($items["slots"] as $item)
{
if ($item['type']<>'0')
{
$temp  = "<div class='itemslot'><div class='block' id=".json_encode(array("num"=>$item['num'],"type"=>$item['type']))." style='margin-right:auto;margin-left:auto;height:32px;width:32px'>";
$temp.= $html->image("/img/items/".$images[$item['type']]['image'],array('alt'=>$images[$item['type']]['image']));
$temp.= "</div><span style='position:relative;top:-20px;z-index:1000'><b><font color='#ffffff'>".$item['amount']."</font></b></span></div>";
}
else
{
	$temp = "<div class='itemslot'></div>";
}

if ($item['num']>8)
	$inv1.=$temp;
else
	$inv2.=$temp;
}
?>
<div id="apDiv1" class="bagpanel">
<?php echo $inv1; ?>
</div>

<div id="apDiv2" class="handpanel">
<?php echo $inv2; ?>
</div>
</div>
</div>